Examples for doing RR in R
This document provides answers for the rmarkdown appreciation study as of r Sys.Date(). It will include both: the rcode and its output.
Let us have a look at data using glimpse() function.
Rows: 2,920
Columns: 16
$ ID <int> 538, 549, 549, 707, 1116, 1116, 1116, 1555, 2256, 225…
$ Name <chr> "Jernej Abrami", "Alen Abramovi", "Alen Abramovi", "U…
$ Sex <chr> "M", "M", "M", "M", "F", "F", "F", "M", "M", "M", "M"…
$ Age <int> 31, 29, 29, 24, 24, 28, 28, 19, 25, 29, 20, 26, 30, 2…
$ Height <int> 175, 180, 180, 180, 173, 173, 173, 170, 190, 190, 188…
$ Weight <int> 70, 72, 72, 83, 59, 59, 59, 67, 81, 81, 89, 96, 96, 1…
$ Team <chr> "Slovenia", "Croatia", "Croatia", "Slovenia", "Croati…
$ NOC <chr> "SLO", "CRO", "CRO", "SLO", "CRO", "CRO", "CRO", "SCG…
$ Games <chr> "1996 Summer", "2006 Winter", "2006 Winter", "2000 Su…
$ Year <int> 1996, 2006, 2006, 2000, 1996, 2000, 2000, 2000, 1992,…
$ Season <chr> "Summer", "Winter", "Winter", "Summer", "Summer", "Su…
$ City <chr> "Atlanta", "Torino", "Torino", "Sydney", "Atlanta", "…
$ Sport <chr> "Canoeing", "Cross Country Skiing", "Cross Country Sk…
$ Event <chr> "Canoeing Men's Kayak Singles, Slalom", "Cross Countr…
$ Medal <chr> "", "", "", "", "", "", "", "", "Silver", "", "", "Br…
$ BMI <dbl> 22.85714, 22.22222, 22.22222, 25.61728, 19.71332, 19.…
Find the number of medals per each team?
| Team | Medal | cases |
|---|---|---|
| Bosnia and Herzegovina | 134 | |
| Croatia | 727 | |
| Croatia | Bronze | 37 |
| Croatia | Gold | 58 |
| Croatia | Silver | 54 |
| Montenegro | 80 | |
| Montenegro | Silver | 14 |
| Serbia | 303 | |
| Serbia | Bronze | 41 |
| Serbia | Gold | 15 |
| Serbia | Silver | 29 |
| Serbia and Montenegro | 257 | |
| Serbia and Montenegro | Bronze | 26 |
| Serbia and Montenegro | Gold | 12 |
| Serbia and Montenegro | Silver | 26 |
| Slovenia | 1059 | |
| Slovenia | Bronze | 27 |
| Slovenia | Gold | 8 |
| Slovenia | Silver | 13 |
Find the number of medals per each team for the last Rio games?
Visualise data about number of female and male athletes from ex YU countries available in the data set:
identify data to be poloted
visualise data
# A tibble: 12 x 3
# Groups: Team [6]
Team Sex total
<chr> <chr> <int>
1 Bosnia and Herzegovina F 39
2 Bosnia and Herzegovina M 95
3 Croatia F 236
4 Croatia M 640
5 Montenegro F 36
6 Montenegro M 58
7 Serbia F 139
8 Serbia M 249
9 Serbia and Montenegro F 58
10 Serbia and Montenegro M 263
11 Slovenia F 410
12 Slovenia M 697
# A tibble: 12 x 3
# Groups: Team [6]
Team Sex total
<chr> <chr> <int>
1 Bosnia and Herzegovina F 39
2 Bosnia and Herzegovina M 95
3 Croatia F 236
4 Croatia M 640
5 Montenegro F 36
6 Montenegro M 58
7 Serbia F 139
8 Serbia M 249
9 Serbia and Montenegro F 58
10 Serbia and Montenegro M 263
11 Slovenia F 410
12 Slovenia M 697
We need a bar chart with each team on the x axis and a number of male and female athlethes on the y axis (see figure1).
Figure 1: The caption.
Our thanks to all the research present in the workshop.
Tatjana Kecojevic prepared and delivered the workshop material. Balsa Delibasic and Srdjan Prodanovic for organised the event.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".